package jsp.servlet;

import java.io.IOException;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jpa.entities.Employee;
import jpa.entities.Project;
import jsp.Datetime;
import jsp.classes.Session;

/**
 * @author Remco Haszing
 */
public class ArchiveProject extends HttpServlet {

    /**
     * Updates the user's personal data according to the data in the request
     * parameter. This method updates the user's properties and merges them into
     * the database.
     *
     * @param request The request that should be handled.
     * @param response Unused.
     * @throws IOException  
     */
    @Override
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
        try {
            Session session = (Session) request.getSession(true).getAttribute("user");
            
            int projectId = Integer.parseInt(request.getParameter("pid"));

            
            Project p = session.findProjectById(projectId);
            
            p.clone();
            
            
            session.getJPAConnection().edit(p);
            response.getWriter().print("true");
        } catch (Exception e) {
            response.getWriter().print("false");
        }
    }
}
